﻿using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yozeev.BusinessLogic;

namespace Yozeev.Controllers.Stats.Filters
{
    public class RouteFilter : AbstractFilter
    {
        private readonly IRepository<Route, Guid> _routeRep;

        public RouteFilter(IRepository<Route, Guid> routeRep)
        {
            _routeRep = routeRep;
        }

        public override void Decorate(Dictionary<string, IEnumerable<object>> Data)
        {
            if (Data.ContainsKey("Routes")) return;
            var routes = _routeRep.GetAll();
            Data.Add("Routes", routes.ToList());
        }
    }
}
